-
Notifications
You must be signed in to change notification settings - Fork 0
Remove climb tag from OSM normalizer #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Dev Board Ticket https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2304 ## Changes - Derive climb direction from numeric incline when climb is missing - Keep existing incline and climb tags untouched when both are present - Adjust unit and integration tests to cover incline preservation and climb inference - Updated ChangeLog ## Testing - Added unit test cases - Test Results ```bash > python -m coverage run --source=src -m unittest discover test_construct_geometries (helpers.test_osm.TestOSMHelper) ... ok test_count_entities_with_nodes_counter (helpers.test_osm.TestOSMHelper) ... ok test_count_entities_with_points_counter (helpers.test_osm.TestOSMHelper) ... ok test_count_entities_with_ways_counter (helpers.test_osm.TestOSMHelper) ... ok test_get_osm_graph (helpers.test_osm.TestOSMHelper) ... ok test_osw_node_filter (helpers.test_osm.TestOSMHelper) ... ok test_osw_point_filter (helpers.test_osm.TestOSMHelper) ... ok test_osw_polygon_filter (helpers.test_osm.TestOSMHelper) ... ok test_osw_way_filter (helpers.test_osm.TestOSMHelper) ... ok test_osw_zone_filter (helpers.test_osm.TestOSMHelper) ... ok test_simplify_og (helpers.test_osm.TestOSMHelper) ... ok test_cleanup_of_temp_files (helpers.test_osw.TestOSWHelper) ... ok test_construct_geometries (helpers.test_osw.TestOSWHelper) ... ok test_count_entities_with_nodes_counter (helpers.test_osw.TestOSWHelper) ... ok test_count_entities_with_points_counter (helpers.test_osw.TestOSWHelper) ... ok test_count_entities_with_ways_counter (helpers.test_osw.TestOSWHelper) ... ok test_count_lines (helpers.test_osw.TestOSWHelper) ... ok test_count_nodes (helpers.test_osw.TestOSWHelper) ... ok test_count_points (helpers.test_osw.TestOSWHelper) ... ok test_count_polygons (helpers.test_osw.TestOSWHelper) ... ok test_count_ways (helpers.test_osw.TestOSWHelper) ... ok test_count_zones (helpers.test_osw.TestOSWHelper) ... ok test_get_osm_graph (helpers.test_osw.TestOSWHelper) ... ok test_merge (helpers.test_osw.TestOSWHelper) ... ok test_missing_files (helpers.test_osw.TestOSWHelper) ... ok test_osw_node_filter (helpers.test_osw.TestOSWHelper) ... ok test_osw_point_filter (helpers.test_osw.TestOSWHelper) ... ok test_osw_polygon_filter (helpers.test_osw.TestOSWHelper) ... ok test_osw_way_filter (helpers.test_osw.TestOSWHelper) ... ok test_osw_zone_filter (helpers.test_osw.TestOSWHelper) ... ok test_simplify_og (helpers.test_osw.TestOSWHelper) ... ok test_unzip (helpers.test_osw.TestOSWHelper) ... ok test_unzip_should_return_3_files (helpers.test_osw.TestOSWHelper) ... ok test_custom_values (helpers.test_response.TestResponseClass) ... ok test_default_values (helpers.test_response.TestResponseClass) ... ok test_error_none (helpers.test_response.TestResponseClass) ... ok test_error_string (helpers.test_response.TestResponseClass) ... ok test_generated_files_list (helpers.test_response.TestResponseClass) ... ok test_generated_files_string (helpers.test_response.TestResponseClass) ... ok test_cleanup_existing_files (test_formatter.TestFormatter) ... ok test_cleanup_non_existent_files (test_formatter.TestFormatter) ... ok test_osm2osw_error (test_formatter.TestFormatter) ... Creating networks from region extracts... Traceback (most recent call last): File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/osm2osw/osm2osw.py", line 22, in convert osm_graph_results = await asyncio.gather(*tasks) File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/helpers/osw/__init__.py", line 97, in get_osm_graph OG = await loop.run_in_executor( File "/opt/homebrew/Cellar/[email protected]/3.10.17_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/serializer/osm/osm_graph.py", line 342, in from_osm_file way_parser.apply_file(osm_file, locations=True) RuntimeError: Open failed for 'test.pbf': No such file or directory Open failed for 'test.pbf': No such file or directory ok test_osm2osw_successful (test_formatter.TestFormatter) ... Creating networks from region extracts... Created OSW files! ok test_osw2osm_successful (test_formatter.TestFormatter) ... ok test_workdir_already_exists (test_formatter.TestFormatter) ... ok test_workdir_creation (test_formatter.TestFormatter) ... ok test_all_feature_ids_are_strings (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_convert_error (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Traceback (most recent call last): File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/osm2osw/osm2osw.py", line 22, in convert osm_graph_results = await asyncio.gather(*tasks) File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/helpers/osw/__init__.py", line 97, in get_osm_graph OG = await loop.run_in_executor( File "/opt/homebrew/Cellar/[email protected]/3.10.17_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/src/osm_osw_reformatter/serializer/osm/osm_graph.py", line 342, in from_osm_file way_parser.apply_file(osm_file, locations=True) RuntimeError: Open failed for 'test.pbf': No such file or directory Open failed for 'test.pbf': No such file or directory ok test_convert_successful (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_ext_tags_present_in_output (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_generated_3_files (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_generated_files_are_string (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_generated_files_include_nodes_points_edges (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_generated_with_valid_width_tag (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_no_duplicate_ids_in_file (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_no_empty_features (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_nodes_file_has_point_geometry (test_osm2osw.test_osm2osw.TestOSM2OSW) ... Creating networks from region extracts... Created OSW files! ok test_convert_error (test_osw2osm.test_osw2osm.TestOSW2OSM) ... Error during conversion: [Errno 2] No such file or directory: 'test.zip' ok test_convert_generated_files_are_string (test_osw2osm.test_osw2osm.TestOSW2OSM) ... Warning 1: DeprecationWarning: 'Memory' driver is deprecated since GDAL 3.11. Use 'MEM' onwards. Further messages of this type will be suppressed. ok test_convert_successful (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_generated_file (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_generated_file_contains_incline_tag (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_generated_file_does_not_contain_climb_tag (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_generated_file_should_be_xml (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_generated_file_should_be_xml_and_valid_width_tag (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_incline_tags_do_not_have_climb (test_osw2osm.test_osw2osm.TestOSW2OSM) ... ok test_roundtrip (test_roundtrip.test_roundtrip.TestRoundTrip) ... /Users/anuj/Work/Gaussian/TDEI-python-lib-osw-formatter/output/test_roundtrip.graph.osm.xml Creating networks from region extracts... Created OSW files! Executing <Task pending name='Task-164' coro=<IsolatedAsyncioTestCase._asyncioLoopRunner() running at /opt/homebrew/Cellar/[email protected]/3.10.17_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/async_case.py:95> wait_for=<Future pending cb=[Task.task_wakeup()] created at /opt/homebrew/Cellar/[email protected]/3.10.17_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py:429> created at /opt/homebrew/Cellar/[email protected]/3.10.17_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/async_case.py:117> took 0.105 seconds ok test_xml_roundtrip (test_roundtrip.test_roundtrip.TestXMLRoundTrip) ... Creating networks from region extracts... Created OSW files! ok test_from_geojson (test_serializer.test_osm_graph.TestFromGeoJSON) ... ok test_construct_geometries (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_construct_geometries_line_node (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_construct_geometries_missing_node_attributes (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_construct_geometries_point_node (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_filter_edges (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_from_geojson (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_get_graph (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_is_directed (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_is_multigraph (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_line_parser_no_nodes (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_node_parser (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_node_parser_missing_node (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_point_parser (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_polygon_parser (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_polygon_parser_with_inner_rings (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_simplify (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_simplify_circular_path (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_to_geojson (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_to_geojson_empty_graph (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_to_undirected (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_way_parser (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_way_parser_with_filter (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_zone_parser (test_serializer.test_osm_graph.TestOSMGraph) ... ok test_does_not_add_climb_from_negative_incline (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_does_not_add_climb_from_positive_incline (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_does_not_add_climb_from_zero_incline (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_removes_climb_without_incline (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_removes_existing_climb_and_retains_incline (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_retains_non_numeric_incline_without_climb (test_serializer.test_osm_normalizer.TestOSMNormalizeInclineField) ... ok test_preserves_width_when_value_is_float (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_preserves_width_when_value_is_float_with_string (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_preserves_width_when_value_is_int (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_removes_width_when_value_is_actual_nan (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_removes_width_when_value_is_nan_string (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_removes_width_when_value_is_non_numeric_string (test_serializer.test_osm_normalizer.TestOSMNormalizeWidthField) ... ok test_crossing_markings (test_serializer.test_osw_normalizer.TestCommonFunctions) ... ok test_incline (test_serializer.test_osw_normalizer.TestCommonFunctions) ... ok test_surface (test_serializer.test_osw_normalizer.TestCommonFunctions) ... ok test_tactile_paving (test_serializer.test_osw_normalizer.TestCommonFunctions) ... ok test_preserves_width_when_value_is_float (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_preserves_width_when_value_is_float_with_string (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_preserves_width_when_value_is_int (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_removes_width_when_value_is_actual_nan (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_removes_width_when_value_is_nan_string (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_removes_width_when_value_is_non_numeric_string (test_serializer.test_osw_normalizer.TestNormalizeWidthField) ... ok test_is_kerb (test_serializer.test_osw_normalizer.TestOSWNodeNormalizer) ... ok test_is_kerb_invalid (test_serializer.test_osw_normalizer.TestOSWNodeNormalizer) ... ok test_normalize_invalid_node (test_serializer.test_osw_normalizer.TestOSWNodeNormalizer) ... ok test_normalize_kerb (test_serializer.test_osw_normalizer.TestOSWNodeNormalizer) ... ok test_is_powerpole (test_serializer.test_osw_normalizer.TestOSWPointNormalizer) ... ok test_is_powerpole_invalid (test_serializer.test_osw_normalizer.TestOSWPointNormalizer) ... ok test_normalize_powerpole (test_serializer.test_osw_normalizer.TestOSWPointNormalizer) ... ok test_is_crossing (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_footway (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_living_street (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_pedestrian (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_sidewalk (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_stairs (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_is_traffic_island (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_normalize_crossing (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_normalize_invalid_way (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok test_normalize_sidewalk (test_serializer.test_osw_normalizer.TestOSWWayNormalizer) ... ok ---------------------------------------------------------------------- Ran 131 tests in 25.468s OK ```
…osm-compliance Add OSM compliance validation test using python-osw-validation
susrisha
reviewed
Sep 8, 2025
|
|
||
| # OSW fields with similar OSM field names | ||
| if 'highway' in tags and tags['highway'] != 'steps': | ||
| tags.pop('climb', '') |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if climb tag is up or down. If none of these two, probably its best to ignore the value
susrisha
approved these changes
Sep 8, 2025
Contributor
sureshgaussian
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing after review
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dev Board Ticket
https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2304
Changes
Testing